local qingwang = fk.CreateSkill{
  name = "lvshi__qingwang",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["lvshi__qingwang"] = "倾望",
  [":lvshi__qingwang"] = "锁定技，当你受到伤害后，成为过“鸣谦”目标的角色须同时选择是否交给你一张牌，若有角色如此做，你回复1点体力，然后此技能无效直到你发动“鸣谦”。",
  ["#lvshi__qingwang-ask"] = "你可以交给%src一张牌",

  ["$lvshi__qingwang1"] = "人之所至，礼之所及。",
  ["$lvshi__qingwang2"] = "施之以礼，还之以德。",
}

qingwang:addEffect(fk.Damaged, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(qingwang.name) and #player:getTableMark("@[player]chuiqian") > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targets = table.filter(room:getAlivePlayers(), function (p)
      return table.contains(player:getTableMark("@[player]chuiqian"), p.id)
    end)
    local chosenCards = room:askToJointCards(player, {
      skill_name = qingwang.name,
      include_equip = true,
      players = targets,
      max_num = 1,
      min_num = 1,
      prompt = "#lvshi__qingwang-ask:"..player.id
    })
    local recover = false
    for _, p in ipairs(targets) do
      local cards = chosenCards[p]
      if cards and #cards > 0 then
        recover = true
        room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonGive, qingwang.name, nil, false, player)
        room:invalidateSkill(player, qingwang.name)
      end
    end
    if recover then
      room:recover{ who = player, num = 1, skillName = qingwang.name }
    end
  end,
})

return qingwang